class Rectangle{
    protected int length;
    protected int breadth;

    public Rectangle() {}

    public Rectangle(int length, int breadth) {
        this.length = length;
        this.breadth = breadth;
    }

    public int getArea() {
        return length * breadth;
    }

    public int getPerimeter() {
        return (length + breadth) * 2;
    }
}

class Square extends Rectangle {

    public int length;

    public Square(int length) {
        super();
        this.length = length;
    }

    public int getArea() {
        return length * length;
    }

    public int getPerimeter() {
        return length * 4;
    }
}

public class Test2 {
    public static void main(String[] args) {
        Rectangle[] rectangles = new Rectangle[]{new Rectangle(10,20),new Square(10),
                new Square(20), new Rectangle(50,80)};
        for (int i = 0; i < rectangles.length; i++) {
            System.out.println(rectangles[i].getArea());
        }
    }
}
